﻿@page "/timeline/timeline"
@using Blazor.ECharts.Options
@using Blazor.ECharts.Options.Enum
@using B = Blazor.ECharts.Options.Series.Bar

<div class="chart-container">
    <EBar Option="@Option1" Class="chart-fill"></EBar>
</div>

@code{
    private EChartsOption<B.Bar> Option1;

    protected override void OnInitialized()
    {
        base.OnInitialized();

        Option1 = new()
        {
            BaseOption = new()
            {
                Timeline = new()
                {
                    Data = new() { "2017", "2018", "2019" }
                },
                Title = new()
                {
                    Subtext = ""
                },
                XAxis = new()
                {
                    new()
                    {
                        Type = AxisType.Category,
                        Data = new[] { "A公司", "B公司", "C公司" }
                    }
                },
                YAxis = new()
                {
                    new()
                    {
                        Type = AxisType.Value
                    }
                },
                Series = new()
                {
                    new B.Bar() { }
                }
            },
            Options = new()
            {
                new()
                {
                    Title = new()
                    {
                        Text = "2017年销量情况"
                    },
                    Series = new()
                    {
                        new SeriesBase(null)
                        {
                            Data = new[] { 300, 500, 450 }
                        }
                    }
                },
                new()
                {
                    Title = new()
                    {
                        Text = "2018年销量情况"
                    },
                    Series = new()
                    {
                        new SeriesBase(null)
                        {
                            Data = new[] { 500, 600, 1000 }
                        }
                    }
                },
                new()
                {
                    Title = new()
                    {
                        Text = "2019年销量情况"
                    },
                    Series = new()
                    {
                        new SeriesBase(null)
                        {
                            Data = new[] { 650, 700, 950 }
                        }
                    }
                }
            }
        };
    }
}
